n=input()
list1=[0]*26
list2=list(n)
list3=[]
for i in list2:
    list3.append(i.lower())
for j in range(len(list3)):
    if 97<=ord(list3[j])<=122:
        list1[ord(list3[j])-97]+=1
maxlist1=max(list1)
print(maxlist1)
for k in range(len(list1)):
    if list1[k]==maxlist1:
        print(chr(k+97))
